//
//  TSCMyUIUtil.h
//  Tsc_IOS
//
//  Created by Rio on 15-5-8.
//  Copyright (c) 2015年 idream. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "TSCSDK.h"
#import "TSCMyPopupMenu.h"
#import "NikiRadioButton.h" // 注：虽然TSCSDK.h中有对NikiRadioButton的声明，但某些因素导致编译顺序不是按照源代码的书写顺序，所以如果去掉此句，会产生编译错误。参考：http://stackoverflow.com/questions/8105688/expected-a-type-error-pointing-to-the-return-type-of-a-method

@interface TSCMyUIUtil : NSObject

+ (void) popErrWithResourceKey:(NSString *)resourceKey;
+ (void) popErrWithString:(NSString *)string;

+ (void) dispatchLoginUIWithVC:(UIViewController *)viewController ud:(NSUserDefaults *)ud additionalTagArray:(NSArray *)additionalTagArray;

//+ (void) delayReplaceAppDelegateRootViewWithNewVC:(UIViewController *)newViewController completionHandler:(void(^)(UINavigationController * newNavigationController))completionHandler;


+ (void) setUserPicIvWithUserOrEmail:(NSString *)userNameOrEmail imageView:(UIImageView *)imageView isUseDefaultPic:(BOOL)isUseDefaultPic onSuccess:(void(^)())onSuccess onFailure:(void(^)())onFailure;
+ (void) setUserPicIvWithUserPicUrl:(NSString *)userPicUrl imageView:(UIImageView *)imageView isUseDefaultPic:(BOOL)isUseDefaultPic onSuccess:(void(^)())onSuccess onFailure:(void(^)())onFailure;

+ (void) setUIRect:(UIView *)view x:(CGFloat)x y:(CGFloat)y w:(CGFloat)w h:(CGFloat)h;
+ (void) setUIRoundRectBG:(UIView *)view radius:(CGFloat)radius;
+ (void) setUIRoundBorder:(UIView *)view radius:(CGFloat)radius borderColor:(UIColor *)borderColor borderWidth:(CGFloat)borderWidth;
+ (void) setUIImageViewRounded:(UIImageView *)iv;
+ (void) setUIShadow:(UIView *)view;
+ (void) addIconToView:(UIView *)view icon:(UIView *)icon direction:(IconDirection)direction;
+ (UIImageView *) addDownTriangleIconToView:(UIView *)view direction:(IconDirection)direction;
// TODO delete
//+ (UIView *) createHLSInView:(UIView *)view;
//+ (UIView *) createVLSInView:(UIView *)view;
//+ (UIView *) createHP:(CGFloat)padding;
//+ (UIView *) createVP:(CGFloat)padding;
+ (UIView *) addVacancyWithW:(CGFloat)width H:(CGFloat)height forView:(UIView *)forView inView:(UIView *)inView; // 以某个尺寸创建一个占位符，并将传入的UIView居中放置
+ (void) changeLabelColorWithLabel:(UILabel *)label color:(UIColor *)color range:(NSRange)range;

+ (UIFont *) getSystemDefaultFont;
+ (CGRect) getStatusBarFrame; // 获得屏幕最上方状态栏frame
+ (CGRect) getNavigationBarFrame:(UIViewController *) vc; // 获得导航栏frame
+ (ScreenOrientation) getScreenOrientationNow; // 获得屏幕当前的方向
+ (UIViewController *) getAncestorVCofVC:(UIViewController *) vc byClass:(Class) Class; // 从nvc.viewControllers中，找到某层vc。比如：A->B->C->D，然后从D->B，这时就需要找到B

+ (void) popVCLaterWithNVC:(UINavigationController *)nvc animated:(BOOL)animated;
+ (void) removeVCOfVC:(UIViewController *) vcToBeRemoved; // 从nvc.viewControllers中，找到某层vc，并删除它。比如：A->B->C->D，然后删除C，变成：A->B->D。
+ (void) removeVCItselfAndAllPreviousVC:(UIViewController *) vcToBeRemoved; // 从nvc.viewControllers中，找到某层vc，删除它及其之前所有的vc。比如A->B->C->D，然后删除A、B、C，最后得到D
+ (void) popVCStoryWithVC:(UIViewController *)vc; // 以present方式弹出“我们的故事”

+ (void) removeAllSubviews:(UIView *)view;

+ (NSArray *) addConstraintsFillParent2View:(UIView *)view isActiveImmediately:(BOOL)isActiveImmediately;

+ (NikiRadioButton *) getSelectedRadioButton:(NSArray<NikiRadioButton *> *)rbg;

@end
